package com.itheima.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.mapper.OperateLogMapper;
import com.itheima.pojo.OperateLog;
import com.itheima.pojo.OperateLogQueryParam;
import com.itheima.pojo.PageBean;
import com.itheima.service.OperateLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OperateLogServiceImpl implements OperateLogService {

    @Autowired
    private OperateLogMapper operateLogMapper;

    /**
     * 日志列表查询
     *
     * @param page
     * @return
     */
    @Override
    public PageBean findOperateLogPage(OperateLogQueryParam page) {
        PageHelper.startPage(page.getPage(), page.getPageSize());
        List<OperateLog> list = operateLogMapper.selectOperateLogPage(page);
        Page<OperateLog> pageList = (Page<OperateLog>) list;
        return new PageBean(pageList.getTotal(),pageList.getResult());
    }
}
